import { computed, inject, ref } from 'vue'
import { allViewType, EnumAllViewType } from '../imgTypes'

interface IGlobalView {
  [key: string]: allViewType
}

const globalActiveView = ref<IGlobalView>({})


export const useActiveView = (windowId: string) => {

  initActiveView(windowId)

  function setActiveView(viewType: allViewType) {
    globalActiveView.value[windowId] = viewType
  }

  function initActiveView(windowId: string) {
    globalActiveView.value[windowId] = EnumAllViewType.ax
  }


  return {
    activeView: computed(() => globalActiveView.value[windowId]),
    setActiveView
  }

}
